/*********** tuannh ****************
 function : input data 
***********************************/
// Portlet Layers List
var map_WMS, map_WFS;

map_WMS = new Array();
map_WFS = new Array();

// Portlet Tools
var menu_WS;
menu_WS = new Array();

// Save Object
var saveStrategy_Point_Elevation, saveStrategy_Point, saveStrategy_Line, saveStrategy_Polygon;

//alert("OpenLayers : " + OpenLayers.Strategy);
saveStrategy_Point_Elevation = new OpenLayers.Strategy.Save();
saveStrategy_Point = new OpenLayers.Strategy.Save();
saveStrategy_Line = new OpenLayers.Strategy.Save();
saveStrategy_Polygon = new OpenLayers.Strategy.Save();

var bError_Editting = new Array(false, false, false);
// end Save Object 

// Style Map
	
// ElevationPoints
var colorSelected_Point_Elevation = "#FF0000"; // red
var colorUnSelected_Point_Elevation = "#336699"; // light blue
var colorSelected_Point_Delete_Elevation = "#FFFF00"; // yellow
var colorUnSelected_Point_Delete_Elevation = "#336699"; // light blue
// Committe
var colorSelected_Point = "#FFA500"; // dark blue
var colorUnSelected_Point = "#808080"; // gray
var colorSelected_Point_Delete = "#FF0000"; // red
var colorUnSelected_Point_Delete = "#808080"; // gray
// Roads
var colorSelected_Line = "#FF0000"; // red
var colorUnSelected_Line = "#00FF00"; // green
var colorSelected_Line_Delete = "#0000CD"; // medium blue
var colorUnSelected_Line_Delete = "#FF0000"; // green
// Commune
var colorSelected_Fill_Polygon = "#FFFF00"; // yellow
var colorUnSelected_Fill_Polygon = "#FFF8DC"; // Cornsilk
var colorSelected_Fill_Polygon_Delete = "#00FFFF"; // aquq
var colorUnSelected_Fill_Polygon_Delete = "#FF0000"; // red
var colorBorder_Polygon = "#000000"; // black
var defStyle_Point_Elevation =
{
    strokeColor: colorUnSelected_Point_Elevation,
    strokeOpacity: "0.7",
    strokeWidth: 2,
    fillColor: colorUnSelected_Point_Elevation,
    pointRadius: 3,
    cursor: "pointer"
};
var defStyle_Point =
{
    strokeColor: colorUnSelected_Point,
    strokeOpacity: "0.7",
    strokeWidth: 2,
    fillColor: colorUnSelected_Point,
    pointRadius: 5,
    cursor: "pointer"
};

var defStyle_Line =
{
    strokeColor: colorUnSelected_Line,
    strokeOpacity: "0.7",
    strokeWidth: 2,
    fillColor: colorUnSelected_Line,
    pointRadius: 5,
    cursor: "pointer"
};

var defStyle_Polygon =
{
    strokeColor: colorBorder_Polygon,
    strokeOpacity: "0.7",
    strokeWidth: 2,
    fillColor: colorUnSelected_Fill_Polygon,
    pointRadius: 5,
    // label with \n linebreaks
    //label: "${NAME_EN}", //"name: ${name_en}\n\nage: ${age}",     
    //fontColor: "#000000",
    //fontSize: "12px",
    //fontFamily: "Courier New, monospace",
    //fontWeight: "bold",
    //    labelAlign: "${align}",
    //    labelXOffset: "${xOffset}",
    //    labelYOffset: "${yOffset}",
    //labelOutlineColor: "white",
    //labelOutlineWidth: 3,
    cursor: "pointer"
};
// Measure
var defStyle_Measure = {
    "Point": {
        pointRadius: 4,
        graphicName: "square",
        fillColor: "white",
        fillOpacity: 1,
        strokeWidth: 1,
        strokeOpacity: 1,
        strokeColor: "#333333"
    },
    "Line": {
        strokeWidth: 3,
        strokeOpacity: 1,
        strokeColor: "#008B8B",
        strokeDashstyle: "dash"
    },
    "Polygon": {
        strokeWidth: 2,
        strokeOpacity: 1,
        strokeColor: "#666666",
        fillColor: "white",
        fillOpacity: 0.3
    }
};

var sty_Point_Elevation = OpenLayers.Util.applyDefaults(defStyle_Point_Elevation, OpenLayers.Feature.Vector.style["default"]);
var sty_Point = OpenLayers.Util.applyDefaults(defStyle_Point, OpenLayers.Feature.Vector.style["default"]);
var sty_Line = OpenLayers.Util.applyDefaults(defStyle_Line, OpenLayers.Feature.Vector.style["default"]);
var sty_Polygon = OpenLayers.Util.applyDefaults(defStyle_Polygon, OpenLayers.Feature.Vector.style["default"]);
var sty_Measure = new OpenLayers.Style();
sty_Measure.addRules([new OpenLayers.Rule({symbolizer: defStyle_Measure})]);
var sm_Point_Elevation = new OpenLayers.StyleMap({
    'default': sty_Point_Elevation,
    'select':
    {
        strokeColor: colorSelected_Point_Elevation,
        fillColor: colorSelected_Point_Elevation
    },
    'delete_selection':
    {
        strokeColor: colorSelected_Point_Delete_Elevation,
        fillColor: colorSelected_Point_Delete_Elevation
    },
    'after_delete':
    {
        strokeOpacity: "0",
        display: "none"
    }
});
var sm_Point = new OpenLayers.StyleMap({
    'default': sty_Point,
    'select':
    {
        strokeColor: colorSelected_Point,
        fillColor: colorSelected_Point
    },
    'delete_selection':
    {
        strokeColor: colorSelected_Point_Delete,
        fillColor: colorSelected_Point_Delete
    },
    'after_delete':
    {
        strokeOpacity: "0",
        display: "none"
    }
});

var sm_Line = new OpenLayers.StyleMap({
    'default': sty_Line,
    'select':
    {
        strokeColor: colorSelected_Line,
        fillColor: colorSelected_Line
    },
    'delete_selection':
    {
        strokeColor: colorSelected_Line_Delete,
        fillColor: colorSelected_Line_Delete
    },
    'after_delete':
    {
        strokeOpacity: "0",
        display: "none"
    }
});

var sm_Polygon = new OpenLayers.StyleMap({
    'default': sty_Polygon,
    'select':
    {
        strokeColor: colorBorder_Polygon,
        fillColor: colorSelected_Fill_Polygon
    },
    'delete_selection':
    {
        strokeColor: colorSelected_Fill_Polygon_Delete,
        fillColor: colorSelected_Fill_Polygon_Delete
    },
    'after_delete':
    {
        strokeOpacity: "0",
        display: "none"
    }
});
var sm_Measure = new OpenLayers.StyleMap({
	"default": sty_Measure
});
 //end Style Map 

/*********************** INPUT DATA ***********************/
var Titpe_Page = "";
var URL_Map_Server = "";
var URL_Feature_Server = "";
var Feature_NS = "";
var Projection = "";
var Version = "";
var Tolerance = 0;
var Node = false;
var Vertex = false;
var Edge = false;
var indexLayer = 1;
var layer_Selected = null;
var isShow_ScaleBar = true;
var isShow_OV = true;
var isTool_Extension = true;

var bReady_Snap_XML = false;
var bReady_Lanague_XML = false;
var bReady_Layer_XML = false;
var bReady_Menu_XML = false;

/********** language *****************
/***** map portlet *****/
var l_img_path_openlayer = "";
var l_imgOV_alt_Open = "";
var l_imgOV_alt_Close = "";
var l_btn_Map_AddFeature = "";
var l_btn_Map_Cancel = "";
// add feature
var l_th_Map_AddFeature = "";
var l_td_Map_AddFeature_Normal = "";
var l_td_Map_AddFeature_Angle = "";
var l_td_Map_AddFeature_Parallel = "";
var l_td_Map_AddFeature_Direction = "";
var l_td_Map_AddFeature_Vertext = "";
var l_td_Map_AddFeature_Copy = "";
// modify feature
var l_th_Map_ModifyFeature = "";
var l_td_Map_ModifyFeature_Drag = "";
var l_td_Map_ModifyFeature_Vertex = "";
var l_td_Map_ModifyFeature_Attribute = "";
var l_td_Map_FeatureSelected = "";
var l_td_Map_ModifyFeature_UnFeatureSelected = "";
// delete feature
var l_td_Map_ModifyFeature_DelVertex = "";
// merge feature
var l_th_Map_Merge_Feature = "";
var l_td_Map_Merge_Feature_List = "";

/***** layer list portlet *******/
var l_legend_LayerList_Base = "";
var l_legend_LayerList_WMS = "";
var l_legend_LayerList_WFS = "";

/***** tool portlet *********/
var l_legend_Tool_divLayersList = "";
var l_td_Tool_Layer = "";
var l_legend_Tool_divTools = "";
var l_option_Tool_select_0 ="";
var l_msg_Tool_ZoomtoLayer = "";
/***********************************/

function Struct_Data(_names) {
    var names = _names.split('|');
    var count = names.length;
    function constructor() {
        for (var i = 0; i < count; i++) {
            this[names[i]] = arguments[i];
        };
    }
    return constructor;
}


var Vector_Param = Struct_Data("IndexLayer|LayerId|Layer_Name|Visible|StyleMap|Projection|SaveObj|Version|URL|Feature_Type|Feature_NS|Geometry_Name|Geometry_Type|DisplayClass_Draw|DisplayClass_Modify|DisplayClass_Del|Map_Service|Base_Map|Display");

var Menu_Param = Struct_Data("ID|Name|Level|Group|Child|Child_ID|Height");

var Snap_Settings = Struct_Data("IndexLayer|Tolerance|Node|Vertex|Edge");

var XMin = 0, XMax = 0, YMin = 0, YMax = 0;

// menu: ID | Name | Level | Group | Child | Child_ID | Height
var Menu_Item = new Array();
//alert("URL = " + sURL);
$.get(sURL, function (data) {
    $(data).find('menus').each(function () {
        var $menus = $(this);
        $menus.find('menu').each(function () {
            var $menuData = $(this);
            var _ID = $menuData.find('ID').text();
            var _Name = $menuData.find('Name').text();
            var _Level = $menuData.find('Level').text();
            var _Group = '';
            if ($menuData.find('Group').text()) _Group = $menuData.find('Group').text();
            var _Child = '';
            if ($menuData.find('Child').text()) _Child = $menuData.find('Child').text();
            var _Child_ID = '';
            if ($menuData.find('Child_ID').text()) _Child_ID = $menuData.find('Child_ID').text();
            var _Height = '';
            if ($menuData.find('Height').text()) _Height = $menuData.find('Height').text();
            var menuChild = new Menu_Param(_ID, _Name, _Level, _Group, _Child, _Child_ID, _Height);
            Menu_Item[Menu_Item.length] = menuChild;

            // Portlet Tools
            if (_Child_ID == '' && _Name != '-') {
                menu_WS[menu_WS.length] = menuChild;
            };
        });
        bReady_Menu_XML = true;
    });

    $(data).find('Language').each(function () {
    	var $Layer_List = $(this);
    	/****** map portlet ******/
    	l_img_path_openlayer = $Layer_List.find('img_path_openlayer').text();
    	l_imgOV_alt_Open = $Layer_List.find('imgOV_alt_Open').text();
    	l_imgOV_alt_Close = $Layer_List.find('imgOV_alt_Close').text();
    	l_btn_Map_AddFeature = $Layer_List.find('btn_Map_AddFeature').text();
    	l_btn_Map_Cancel = $Layer_List.find('btn_Map_Cancel').text();
    	l_Tool_Extension = $Layer_List.find('Tool_Extension').text();
    	// add feature      	
    	l_th_Map_AddFeature = $Layer_List.find('th_Map_AddFeature').text();
    	l_td_Map_AddFeature_Normal = $Layer_List.find('td_Map_AddFeature_Normal').text();
    	l_td_Map_AddFeature_Angle = $Layer_List.find('td_Map_AddFeature_Angle').text();
    	l_td_Map_AddFeature_Parallel = $Layer_List.find('td_Map_AddFeature_Parallel').text();
    	l_td_Map_AddFeature_Direction = $Layer_List.find('td_Map_AddFeature_Direction').text();
    	l_td_Map_AddFeature_Vertext = $Layer_List.find('td_Map_AddFeature_Vertext').text();    
    	l_td_Map_AddFeature_Copy = $Layer_List.find('td_Map_AddFeature_Copy').text();    
    	// modify feature
    	l_th_Map_ModifyFeature = $Layer_List.find('th_Map_ModifyFeature').text();
    	l_td_Map_ModifyFeature_Drag = $Layer_List.find('td_Map_ModifyFeature_Drag').text();
    	l_td_Map_ModifyFeature_Vertex = $Layer_List.find('td_Map_ModifyFeature_Vertex').text();
    	l_td_Map_ModifyFeature_Attribute = $Layer_List.find('td_Map_ModifyFeature_Attribute').text();
    	l_td_Map_FeatureSelected = $Layer_List.find('td_Map_FeatureSelected').text();
    	l_td_Map_ModifyFeature_UnFeatureSelected = $Layer_List.find("td_Map_ModifyFeature_UnFeatureSelected").text();
    	// delete feature
    	l_td_Map_ModifyFeature_DelVertex = $Layer_List.find("td_Map_ModifyFeature_DelVertex").text();
    	// merge feature
    	l_th_Map_Merge_Feature = $Layer_List.find('th_Map_Merge_Feature').text();
    	l_td_Map_Merge_Feature_List = $Layer_List.find('td_Map_Merge_Feature_List').text();    	
    	
    	/****** layer list portlet ******/
    	l_legend_LayerList_Base = $Layer_List.find('legend_LayerList_Base').text();
    	l_legend_LayerList_WMS = $Layer_List.find('legend_LayerList_WMS').text();
    	l_legend_LayerList_WFS = $Layer_List.find('legend_LayerList_WFS').text();
    	
    	/****** tool portlet ******/
    	l_legend_Tool_divLayersList = $Layer_List.find('legend_Tool_divLayersList').text();
    	l_td_Tool_Layer = $Layer_List.find('td_Tool_Layer').text();
    	l_legend_Tool_divTools = $Layer_List.find('legend_Tool_divTools').text();
    	l_option_Tool_select_0 = $Layer_List.find('option_Tool_select_0').text();    
    	l_msg_Tool_ZoomtoLayer = $Layer_List.find('msg_Tool_ZoomtoLayer').text();    
    	bReady_Lanague_XML = true;
    });
    
    $(data).find('bounds').each(function () {
        var $boundData = $(this);
        XMin = $boundData.find('xmin').text();
        XMax = $boundData.find('xmax').text();
        YMin = $boundData.find('ymin').text();
        YMax = $boundData.find('ymax').text();
    });

    $(data).find('titlePage').each(function () {
        var $titlePage = $(this);
        if ($titlePage.text()) Titpe_Page = "<H2>" + $titlePage.text() + "</H2>";
    });

    $(data).find('URL_Map_Server').each(function () {
        var $URL_Server = $(this);
        if ($URL_Server.text()) URL_Map_Server = $URL_Server.text();
    });

    $(data).find('URL_Feature_Server').each(function () {
        var $URL_Server = $(this);
        if ($URL_Server.text()) URL_Feature_Server = $URL_Server.text();
    });

    $(data).find('Feature_NS').each(function () {
        var $Feature_NS = $(this);
        if ($Feature_NS.text()) Feature_NS = $Feature_NS.text();
    });

    $(data).find('Projection').each(function () {
        var $Projection = $(this);
        if ($Projection.text()) Projection = $Projection.text();
    });

    $(data).find('Version').each(function () {
        var $Version = $(this);
        if ($Version.text()) Version = $Version.text();
    });

    $(data).find('Scalbar').each(function () {
        var $Scalbar = $(this);
        if ($Scalbar.text()) isShow_ScaleBar = $Scalbar.text()=="0" ? false : true;
    });

    $(data).find('Overview').each(function () {
        var $Overview = $(this);
        if ($Overview.text()) isShow_OV = $Overview.text()=="0" ? false : true;
    });

    $(data).find('Tool_Extension').each(function () {
        var $Tool_Extension = $(this);
        if ($Tool_Extension.text()) isTool_Extension = $Tool_Extension.text()=="0" ? false : true;
    });

    $(data).find('Layers').each(function () {
        var $Layers = $(this);
        $Layers.find('Layer').each(function () {
            var $Layer = $(this);
            var LayerId = '';
            if ($Layer.find('LayerId').text()) LayerId = $Layer.find('LayerId').text();
            var Layer_Name = '';
            if ($Layer.find('Layer_Name').text()) Layer_Name = $Layer.find('Layer_Name').text();

            var Visible = '';
            if ($Layer.find('Visible').text()) Visible = $Layer.find('Visible').text();
            Visible = Visible == '1' ? true : false;

            var Geometry_Name = '';
            if ($Layer.find('Geometry_Name').text()) Geometry_Name = $Layer.find('Geometry_Name').text();

            var Geometry_Type = '';
            if ($Layer.find('Geometry_Type').text()) Geometry_Type = $Layer.find('Geometry_Type').text();

            var Map_Service = false;
            if ($Layer.find('Map_Service').text()) Map_Service = $Layer.find('Map_Service').text();
            Map_Service = Map_Service == '1' ? true : false;

            var Base_Map = '';
            if ($Layer.find('Base_Map').text()) Base_Map = $Layer.find('Base_Map').text();
            Base_Map = Base_Map == '1' ? true : false;

            var Display = '';
            if ($Layer.find('Display').text()) Display = $Layer.find('Display').text();
            Display = Display == '1' ? true : false;

            // StyleMap - SaveObj
            var styleMap = null;
            var saveObj = null;
            var URL=URL_Map_Server;
            if(!Map_Service) URL=URL_Feature_Server;
            var class_Draw = "olControlDrawFeaturePoint";
            var class_Modify = "olControlModifyFeature";
            var class_Del = "olControlDeleteFeature";
            
            if (Geometry_Type == 'point') {
                styleMap = sm_Point;
                if (!Map_Service) {
                    saveObj = new OpenLayers.Strategy.Save();
                    saveObj.events.register('start', null, saveStart_Point);
                    saveObj.events.register('success', null, saveSuccess_Point);
                    saveObj.events.register('fail', null, saveFail_Point);
                }
            	class_Draw = "olControlDrawFeaturePoint";
            }
            else if (Geometry_Type == 'polyline') {
                styleMap = sm_Line;
                if (!Map_Service) {
                    saveObj = new OpenLayers.Strategy.Save();
                    saveObj.events.register('start', null, saveStart_Line);
                    saveObj.events.register('success', null, saveSuccess_Line);
                    saveObj.events.register('fail', null, saveFail_Line);
                }
            	class_Draw = "olControlDrawFeatureLine";
            }
            else if (Geometry_Type == 'polygon') {
                styleMap = sm_Polygon;
                if (!Map_Service) {
                    saveObj = new OpenLayers.Strategy.Save();
                    saveObj.events.register('start', null, saveStart_Polygon);
                    saveObj.events.register('success', null, saveSuccess_Polygon);
                    saveObj.events.register('fail', null, saveFail_Polygon);
                }
            	class_Draw = "olControlDrawFeaturePolygon";
            }

            var map = null;
            // IndexLayer | LayerId | Layer_Name | Visible | StyleMap | Projection | SaveObj | Version | URL | Feature_Type | Feature_NS | 
            // Geometry_Name | Geometry_Type | DisplayClass_Draw | DisplayClass_Modify | DisplayClass_Del | Map_Service | Base_Map | Display
            if(Base_Map) map = new Vector_Param(0, LayerId, Layer_Name, Visible, styleMap, Projection, 
            		saveObj, Version, URL, LayerId, Feature_NS, Geometry_Name, Geometry_Type, 
            		class_Draw, class_Modify, class_Del, Map_Service, Base_Map, Display);
            else map = new Vector_Param(indexLayer++, LayerId, Layer_Name, Visible, styleMap, Projection, 
            		saveObj, Version, URL, LayerId, Feature_NS, Geometry_Name, Geometry_Type, 
            		class_Draw, class_Modify, class_Del, Map_Service, Base_Map, Display);
            if (Vector_Array == null) Vector_Array = new Array();
            Vector_Array[Vector_Array.length] = map;
            
            // Portlet Layer List
            if (Map_Service && !Base_Map) {
                map_WMS[map_WMS.length] = map;
            }
            else if (!Map_Service && !Base_Map) {
                map_WFS[map_WFS.length] = map;
            }
        });
        bReady_Layer_XML = true;
    });

    $(data).find('snaps').each(function () {
        var $snapData = $(this);
        if ($snapData.find('Tolerance').text()) Tolerance = $snapData.find('Tolerance').text();
        var _Node = $snapData.find('Node').text();
        if (_Node == "1") Node = true;
        var _Vertex = $snapData.find('Vertex').text();
        if (_Vertex == "1") Vertex = true;
        var _Edge = $snapData.find('Edge').text();
        if (_Edge == "1") Edge = true;
        bReady_Snap_XML = true;
    });
});

// IndexLayer | Tolerance | Node | Vertex | Edge
var Snap_Array = new Array();

var Vector_Obj = new Array(); // chua doi tuong vector (WFS + WMS) trong OpenLayer
var Snap_Obj = new Array();
var Draw_Obj = new Array();
var Modify_Obj = new Array();
var Del_Obj = new Array();
var DelVertices_Obj = new Array();
var Save_Obj = new Array();

// layerList: div tag - a tag
var LayerList_Div = new Array();
var LayerList_A = new Array();

var iGroup_Max = 3;
var iLevel_Max = 2;
// so luong menu lon nhat cua 1 nhanh
var iMenuItem_Max = 10;

// delete feature
var isDrawBox = true;
var isConfirm = true;
var feature_Delete = new Array();
var click_Map_Delete = false;
var index_Feature_Del = 0;

var _divMenu_Editor = null;
var iNum_Vector = 4;
var Vector_Array = new Array();
var MAp_Array = new Array();

var objLoadXML = null;
var bStart = false;
function loadXML() {
	if(!bReady_Snap_XML && !bReady_Lanague_XML && !bReady_Layer_XML && !bReady_Menu_XML) {
		//alert("reset...");
        objLoadXML = setTimeout('loadXML()', 1000);
    }
    else {
    	bReady_Snap_XML = bReady_Lanague_XML = bReady_Layer_XML = bReady_Menu_XML = true;
        clearTimeout(objLoadXML);
        bStart = true;
        init_LayerList();
		init_Tools();
		loadSnaping();
		init('map');
    }
}

Field_Alias =
{
    Index: 0,
    Name: "",
    Type: "",
    Alias: "",
    IsShow: false,
    IsEditor: false,
    LayerName: "",
    IsCategory: false,
    TableName: "",
    FieldValue: "",
    FieldDisplay: "",
    
    create: function () {
        var len = arguments.length;
        if (len > 0) this.Index = arguments[0];
        if (len > 1) this.Name = arguments[1];
        if (len > 2) this.Type = arguments[2];
        if (len > 3) this.Alias = arguments[3];
        if (len > 4) this.IsShow = arguments[4] == "0" ? false : true;
        if (len > 5) this.IsEditor = arguments[5] == "0" ? false : true;
        if (len > 6) this.LayerName = arguments[6];        
        if (len > 7) this.IsCategory = arguments[7] == "1" ? true : false;
        if (len > 8) this.TableName = arguments[8];        
        if (len > 9) this.FieldValue = arguments[9];        
        if (len > 10) this.FieldDisplay = arguments[10];        
    }
};

var bReady_Alias_XML = false;
var arrField_Alias = new Array();
var arrField_Alias_Current = new Array();

$.get(sURL_Field, function (data) {
    $(data).find('alias').each(function () {
        var $alias = $(this);
        $alias.find('Field').each(function () {
            var $fieldAlias = $(this);
            var _Index = $fieldAlias.attr('Index');
            var _Name = $fieldAlias.attr('Name');
            var _Type = $fieldAlias.attr('Type');
            var _Alias = $fieldAlias.attr('Alias');
            var _IsShow = $fieldAlias.attr('IsShow');
            var _IsEditor = $fieldAlias.attr('IsEditor');
            var _layerName = $fieldAlias.attr('layerName');
            var _isCategory = $fieldAlias.attr('isCategory');
            var _TableName = $fieldAlias.attr('TableName');
            var _FieldValue = $fieldAlias.attr('FieldValue');
            var _FieldDisplay = $fieldAlias.attr('FieldDisplay');
            
            var _field_alias = new Field_Alias.create(_Index, _Name, _Type, _Alias, _IsShow, _IsEditor, _layerName, _isCategory,
            		_TableName, _FieldValue, _FieldDisplay);
            arrField_Alias[arrField_Alias.length] = _field_alias;
        });
        arrField_Alias.sort
        (
            function (a, b) {
                var x = a.Index - b.Index;
                return x;
            });
        bReady_Alias_XML = true;
    });
});
/******* end function input data ************/


/*************************************
			SAVE FEATURE
*************************************/
var bSaveEditting = true;
// POINT
function saveStart_Point(e)
{
	
}

function saveSuccess_Point(e)
{
	alert("Point saved...");
}

function saveFail_Point(e)
{
	alert("Error when saving point...");
	
}

// LINE
function saveStart_Line()
{
	
}

function saveSuccess_Line()
{
	alert("Line saved...");	
}

function saveFail_Line()
{
	alert("Error when saving line...");
}

// POLYGON
function saveStart_Polygon()
{
	
}

function saveSuccess_Polygon()
{
	alert("Polygon saved...");
}

function saveFail_Polygon(evt)
{
	//alert(evt);
	alert("Error when saving polygon...");
}
/************************************/
